package org.amicofragile.test.ws.service;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;

@WebService(name = "Euro", serviceName = "EuroService", targetNamespace = "http://service.ws.test.amicofragile.org/")
public class EuroServiceImpl
{
	private static final double LIRE_PER_EURO = 1936.27;
	
	@WebMethod(operationName = "toLire")
	public double euroToLire(@WebParam(targetNamespace="http://service.ws.test.amicofragile.org/", name = "euro") double euro)
	{
		System.out.println("EuroServiceImpl.euroToLire: " + euro);
		return euro * LIRE_PER_EURO;
	}
	
	@WebMethod(operationName = "toEuro")
	public double lireToEuro(@WebParam(targetNamespace="http://service.ws.test.amicofragile.org/", name = "lire") double lire)
	{
		System.out.println("EuroServiceImpl.lireToEuro: " + lire);
		return (lire / LIRE_PER_EURO);
	}
	
	@WebMethod(operationName = "buildDescr")
	public String getDescription()
	{
		System.out.println("EuroServiceImpl.getDescription()");
		return "JAVA Euro Converter";
	}
	
	@WebMethod(operationName = "adder")
	public int sum(@WebParam(targetNamespace="http://service.ws.test.amicofragile.org/", name = "a")int x, 
			@WebParam(targetNamespace="http://service.ws.test.amicofragile.org/", name = "b")int y)
	{
		System.out.println("EuroServiceImpl.sum():  " +  x + ", " + y);
		return x + y;
	}
}